package cn.pugle.oj.leetcode;

import cn.pugle.oj.catalog.DaiBi;
import cn.pugle.oj.catalog.Unknown;

/**
 * Created by tzp on 2015/10/18.
 */
public class LC4_MedianOfTwoSortedArraysV2 implements DaiBi {

    public double findMedianSortedArrays(int[] nums1, int[] nums2) {
        int sumLength = nums1.length + nums2.length;
        int halfOfSumLength, cutNums = 0;
        int beginIndex1 = 0, beginIndex2 = 0;
        boolean nextToCutIs1 = false;
        if (sumLength % 2 == 0) {
            halfOfSumLength = sumLength / 2;
            double medianValue1, medianValue2;
            medianValue1 = (nums1[(nums1.length - 1) / 2] + nums1[nums1.length / 2]) / 2.0;
            medianValue2 = (nums2[(nums2.length - 1) / 2] + nums2[nums2.length / 2]) / 2.0;
            if (medianValue1 < medianValue2) {
                beginIndex1 = (nums1.length - 1) / 2;
                cutNums += (nums1.length - 1) / 2;
                nextToCutIs1 = false;
            } else {
                beginIndex2 = (nums2.length - 1) / 2;
                cutNums += (nums2.length - 1) / 2;
                nextToCutIs1 = true;
            }

        } else {
            halfOfSumLength = sumLength / 2;
        }
        return 0;
    }

    public static void main(String[] args) {

    }
}
